package com.yic.module.device.dal.mysql.inspectionRecord;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.inspectionRecord.InspectionRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.inspectionRecord.vo.*;

/**
 * 巡检/点检记录 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface InspectionRecordMapper extends BaseMapperX<InspectionRecordDO> {

    default PageResult<InspectionRecordDO> selectPage(InspectionRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionRecordDO>()
                .eqIfPresent(InspectionRecordDO::getCode, reqVO.getCode())
                .eqIfPresent(InspectionRecordDO::getInspectionType, reqVO.getInspectionType())
                .eqIfPresent(InspectionRecordDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(InspectionRecordDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(InspectionRecordDO::getJobId, reqVO.getJobId())
                .betweenIfPresent(InspectionRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionRecordDO::getId));
    }

    default List<InspectionRecordDO> selectList(InspectionRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InspectionRecordDO>()
                .eqIfPresent(InspectionRecordDO::getCode, reqVO.getCode())
                .eqIfPresent(InspectionRecordDO::getInspectionType, reqVO.getInspectionType())
                .eqIfPresent(InspectionRecordDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(InspectionRecordDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(InspectionRecordDO::getJobId, reqVO.getJobId())
                .eqIfPresent(InspectionRecordDO::getCreator,reqVO.getCreator())
                .betweenIfPresent(InspectionRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionRecordDO::getId));
    }

}
